package com.jyw.business.de.controller;

import com.jyw.business.de.service.ISysDemandReminderConfigService;
import com.jyw.common.annotation.Log;
import com.jyw.common.core.domain.CommonResult;
import com.jyw.common.enums.BusinessType;
import com.jyw.system.domain.vo.SysDemandReminderConfigVo;
import com.jyw.system.domain.vo.SysOrderReminderConfigVo;
import com.jyw.system.service.ISysOrderReminderConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author Created by ZhangCheng on 2023/08/16 (系统工单提醒配置)
 */
@Api(tags = "系统需求提醒配置")
@RestController
@RequestMapping("/system/demand/reminder/config")
public class SysDemandReminderConfigController {

    @Resource
    private ISysDemandReminderConfigService sysDemandReminderConfigService;

    /**
     * 获取系统需求提醒配置
     *
     * @return
     */
    @GetMapping("/getConfig")
    @ApiOperation("获取系统需求提醒配置")
    public CommonResult<SysDemandReminderConfigVo> getConfig() {
        return CommonResult.success(sysDemandReminderConfigService.getDefaultConfig());
    }

    /**
     * 修改系统需求提醒配置
     *
     * @param sysDemandReminderConfigVo
     * @return
     */
    @Log(title = "修改系统需求提醒配置", businessType = BusinessType.UPDATE)
    @PutMapping("/updateConfig")
    @ApiOperation("修改系统需求提醒配置")
    public CommonResult updateConfig(@RequestBody @Valid SysDemandReminderConfigVo sysDemandReminderConfigVo) {
        sysDemandReminderConfigService.updateConfig(sysDemandReminderConfigVo);
        return CommonResult.success();
    }
}
